﻿Imports System.Data.SqlClient
Public Class dbEmployer
    Dim Var As New varDeclare

    Public Function GetEmployerList() As DataSet
        Dim connection As SqlConnection
        Dim adapter As SqlDataAdapter
        Dim command As New SqlCommand
        Dim ds As New DataSet
        connection = New SqlConnection(Var.ConnString)
        connection.Open()
        command.Connection = connection
        command.CommandType = CommandType.Text
        command.CommandText = "SELECT * FROM v_EmployerList"
        adapter = New SqlDataAdapter(command)
        adapter.Fill(ds)
        connection.Close()
        Return ds
    End Function

    Public Function EmployerManagement(Type As String, empGenID As String, empFullName As String, empAddress As String, empPhone As String, posGenID As String, UserID As String) As Boolean
        Dim connection As SqlConnection
        Dim command As New SqlCommand
        connection = New SqlConnection(Var.ConnString)
        connection.Open()
        command.Connection = connection
        command.CommandType = CommandType.StoredProcedure
        command.CommandText = "proc_EmployerManagement"
        command.Parameters.Add("@Type", SqlDbType.VarChar).Value = Type
        command.Parameters.Add("@empGenID", SqlDbType.VarChar).Value = empGenID
        command.Parameters.Add("@empFullName", SqlDbType.VarChar).Value = empFullName
        command.Parameters.Add("@empAddress", SqlDbType.VarChar).Value = empAddress
        command.Parameters.Add("@empPhone", SqlDbType.VarChar).Value = empPhone
        command.Parameters.Add("@posGenID", SqlDbType.VarChar).Value = posGenID
        command.Parameters.Add("@UserID", SqlDbType.VarChar).Value = UserID
        Dim result As Object = command.ExecuteScalar()
        connection.Close()
        Return Convert.ToBoolean(result)
    End Function
End Class
